{include file="public/head"/}
<div class="layui-fluid">
    <div class="layui-row layui-col-space15">
        <div class="layui-col-md12">
            <div class="layui-card">
                <div class="layui-card-body" pad15>
                    <div class="layui-form" wid100 lay-filter="">
                        <div class="layui-tab">
                            <ul class="layui-tab-title">
                                <li class="layui-this">基础设置</li>
                                <li>SEO管理</li>
                            </ul>
                            <div class="layui-tab-content">
                                <div class="layui-tab-item layui-show">                                   
                                	
                                    <div class="layui-form-item">
                                        <div class="layui-inline">
                                            <label class="layui-form-label">上级栏目</label>
                                            <div class="layui-input-inline">
                                                <select name="catid" id="catid">
                                                    <option value="0" {if condition="(isset($info)&&($info.catid eq 0))||empty($info)"}selected{/if}>顶级栏目</option>
                                                    {volist name="categorys" id="vo"}
                                                    <option {if condition="isset($info)&&($info.catid eq $vo['id'])"}selected{/if} value="{$vo.id}">{$vo.lefthtml}{$vo.title}</option>
                                                    {/volist}
                                                </select>
                                            </div>
                                        </div>
                                    </div>
                                    <div class="layui-form-item">
                                        <div class="layui-inline">
                                            <label class="layui-form-label">标题</label>
                                            <div class="layui-input-inline">
                                                <input type="text" name="title" lay-verify="required" value="{$info.title|default=''}" placeholder="{:lang('pleaseEnter')}栏目名称" class="layui-input">
                                            </div>
                                        </div>
         
                                    </div>
                                    
                                    <div class="layui-form-item">
                                        <label class="layui-form-label">缩略图</label>
                                        <div class="layui-input-inline">
                                            <input name="thumb" lay-verify="required" id="thumb" value="{$info.thumb|default=''}" placeholder="图片地址" class="layui-input">
                                        </div>
                                        <div class="layui-input-inline layui-btn-container" style="width: auto;">
                                            <button type="button" class="layui-btn" id="thumbUpload">
                                                <i class="layui-icon">&#xe67c;</i>上传图片
                                            </button>
                                            <button class="layui-btn layui-btn-primary" layadmin-event="logoShow">查看图片</button >
                                        </div>
                                    </div>                                    
                                    
                                    <div class="layui-form-item">

                                        <label class="layui-form-label">简单描述</label>
                                        <div class="layui-col-md9">
                                       	 <textarea placeholder="{:lang('pleaseEnter')}简单描述" rows="5" name="description" id="description" class="layui-textarea">{$info.description|default=''}</textarea>
                                        </div>

                                    </div>
                                    
                                 <!--一行多列开始-->   
                                 <div class="layui-form-item">
                                    <div class="layui-inline">
                                      <label class="layui-form-label">多规则验证</label>
                                      <div class="layui-input-inline">
                                        <input type="text" name="number" lay-verify="required|number" autocomplete="off" class="layui-input">
                                      </div>
                                    </div>
                                    <div class="layui-inline">
                                      <label class="layui-form-label">验证日期</label>
                                      <div class="layui-input-inline">
                                        <input type="text" name="date" id="LAY-component-form-group-date" lay-verify="date" placeholder="yyyy-MM-dd" autocomplete="off" class="layui-input" lay-key="1">
                                      </div>
                                    </div>
                                    <div class="layui-inline">
                                      <label class="layui-form-label">验证链接</label>
                                      <div class="layui-input-inline">
                                        <input type="tel" name="url" lay-verify="url" autocomplete="off" class="layui-input">
                                      </div>
                                    </div>
                                  </div>                                                                                                   
                                  <!--一行多列结束-->
                                   
                                  <!--开关按钮开始--> 
                                  <div class="layui-form-item">
                                    <label class="layui-form-label">开关-默认开</label>
                                    <div class="layui-input-block">
                                      <input type="checkbox" checked="" name="open" lay-skin="switch" lay-filter="component-form-switchTest" lay-text="ON|OFF"><div class="layui-unselect layui-form-switch layui-form-onswitch" lay-skin="_switch"><em>ON</em><i></i></div>
                                    </div>
                                  </div>                                      
                                   <!--开关按钮结束-->  
                                    
                                  <!--复选框开始--> 
                                  <div class="layui-form-item" pane="">
                                    <label class="layui-form-label">原始复选框</label>
                                    <div class="layui-input-block">
                                      <input type="checkbox" name="like1[write]" lay-skin="primary" title="写作" checked="">
                                      <input type="checkbox" name="like1[read]" lay-skin="primary" title="阅读">
                                    </div>
                                  </div>                                   
                                  <!--复选框结束--> 
                                  
                                  <!--单选框开始-->  
                                <div class="layui-form-item">
                                    <label class="layui-form-label">单选框</label>
                                    <div class="layui-input-block">
                                      <input type="radio" name="sex" value="男" title="男" checked=""><div class="layui-unselect layui-form-radio layui-form-radioed"><i class="layui-anim layui-icon"></i><div>男</div></div>
                                      <input type="radio" name="sex" value="女" title="女"><div class="layui-unselect layui-form-radio"><i class="layui-anim layui-icon"></i><div>女</div></div>
                                      <input type="radio" name="sex" value="禁" title="禁用" disabled=""><div class="layui-unselect layui-form-radio layui-radio-disbaled layui-disabled"><i class="layui-anim layui-icon"></i><div>禁用</div></div>
                                    </div>
                                  </div>  
                                 <!--单选框结束-->                                  
                                  
                                    {volist name="fields" id="r"}
                                    {if condition="!empty($r['status'])"}
                                    
                                    	{if condition="$r.type eq 'image'"}
                                        	{:moduleFrom($r,isset($info[$r.field])?$info[$r.field]:'')}
                                        {else}
                                            <div class="layui-form-item">
                                                <label class="layui-form-label">{$r.name}</label>
                                                {:moduleFrom($r,isset($info[$r.field])?$info[$r.field]:'')}
                                            </div>  
                                        {/if}

                                    {/if}
                                    {/volist}                                                                         
                                    
                                    <div class="layui-form-item">
                                        <label class="layui-form-label">详情内容</label>
                                        <div class="layui-col-md9">
                                       	 <textarea placeholder="{:lang('pleaseEnter')}SEO描述" rows="20" name="content" id="content" class="layui-textarea editor">{$info.content|default=''}</textarea>
                                        </div>
                                    </div>     
                                    
  
                                  
 

                                </div>
                                <div class="layui-tab-item">
                                    <div class="layui-form-item">
                                        <label class="layui-form-label">SEO标题</label>
                                        <div class="layui-input-inline">
                                            <input type="text" name="seo_title" placeholder="{:lang('pleaseEnter')}SEO标题" value="{$info.seo_title|default=''}" class="layui-input">
                                        </div>
                                    </div>
                                    <div class="layui-form-item layui-form-text">
                                        <label class="layui-form-label">SEO关键字</label>
                                        <div class="layui-input-block">
                                            <textarea placeholder="{:lang('pleaseEnter')}SEO关键字" name="seo_keywords" class="layui-textarea">{$info.seo_keywords|default=''}</textarea>
                                        </div>
                                    </div>
                                    <div class="layui-form-item layui-form-text">
                                        <label class="layui-form-label">SEO描述</label>
                                        <div class="layui-input-block">
                                            <textarea placeholder="{:lang('pleaseEnter')}SEO描述" name="seo_desc" class="layui-textarea">{$info.seo_desc|default=''}</textarea>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <div class="layui-input-block">
                                <input type="hidden" name="id" value="{$info.id|default=''}">
                                <button class="layui-btn" lay-submit lay-filter="edit-but">确认保存</button>
                            </div>
                        </div>
                    </div>

                </div>
            </div>
        </div>
    </div>
</div>

{include file="public/foot"/}
<script src="/static/vend/kindeditor/kindeditor-min.js" type="text/javascript"></script>
<script language="javascript">
 var editor;
  KindEditor.ready(function(K) {
    editor = K.create('.editor', {
      resizeType: 1,
      allowPreviewEmoticons: false,
      allowImageUpload: false,
      afterBlur: function() {
        this.sync();
      }
    });
  });
</script>
<script>
    layui.config({
        base: '__LAYDMIN__/',{if config('app.app_debug')}version: true{/if}
    }).extend({
        index: 'lib/index' //主入口模块
    }).use(['index','form','admin','table','colorpicker','upload'],function(){
			var $ = layui.$, admin = layui.admin, table = layui.table, element = layui.element, form = layui.form,util = layui.util, upload = layui.upload,colorpicker = layui.colorpicker;
			//编辑提交
			var uri="{if isset($id)}{:url(SYS_PATH.'/Article/edit')}{else}{:url(SYS_PATH.'/Article/add')}{/if}";
			form.on('submit(edit-but)', function (data) {
				admin.req({
					url: uri //实际使用请改成服务端真实接口
					, type: 'post'
					, data: data.field
					, done: function (res) {
						window.top.layer.msg(res.msg, {icon: 1, time: 1000,shade:[0.5,'#000']}, function () {
							layer.closeAll("iframe");
							//刷新父页面
							parent.location.reload();
						});
					}
				});
			});	
			
		//上传logo
		var thumb = $('#thumb');
		upload.render({
			url: '{:url(SYS_PATH."/uploads/upimg")}'
			, elem: '#thumbUpload'
			, done: function (res) {
				if (res.code == 0) {
					thumb.val(res.url);
					//logo.parent().append('<input type="hidden" name="logo_aid" value="'+res.aid+'">')
				} else {
					layer.msg(res.msg, {icon: 5});
				}
			}
		});
		//查看logo
		admin.events.logoShow = function (othis) {
			var src = thumb.val();
			layer.photos({
				photos: {
					"title": "查看图片" //相册标题
					, "data": [{
						"src": src //原图地址
					}]
				}
				, shade: 0.01
				, closeBtn: 1
				, anim: 5
			});
		};			
			
			
	});
</script>
</body>
</html>